package com.gengine.resource.loader
{
	import flash.utils.*;
	
	public class DataLoader extends BaseLoader
	{
		private var _data:ByteArray = null;
		
		public function DataLoader()
		{
		}
		
		override public function getClass() : Class
		{
			return DataLoader;
		}
		
		public function get bytesData() : ByteArray
		{
			return this._data;
		}
		
		override public function initialize(bytes:*) : void
		{
			if (!(bytes is ByteArray))
			{
				throw new Error("DataResource can only handle ByteArrays.");
			}
			this._data = bytes;
			if (resourceInfo)
			{
				resourceInfo.data = this._data;
			}
			onLoadCompleteHandler();
		}
		
		override protected function onContentReady(param:*) : Boolean
		{
			return this._data != null;
		}
	}
}
